package day20171010;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;

import java.io.*;

public class JsoupReadTxt {

    public static void main(String[] args) throws IOException {

        String pathName = "D:\\dev\\poi_ids.txt";

        // 读取txt文件
        File filename = new File(pathName);

        // 建立一个输入流对象reader
        InputStreamReader reader = new InputStreamReader(
                new FileInputStream(filename));


        BufferedReader br = new BufferedReader(reader);

        String line = "";
        line = br.readLine();

        int i = 0;


        String url = " ";
        while (line != null) {
            i++;
//            System.out.println(i+"|"+line);
            line = br.readLine(); // 一次读入一行数据
            url = "http://www.mafengwo.cn/poi/"+line+".html";

            Document doc = Jsoup.connect(url).get();

            Elements elements = doc.select("div._j_commentlist");



            System.out.println(doc);

            if(i == 2) break;
        }









    }
}
